package com.cf.conf.core.formate;

import com.cf.constant.EnumReturnCode;
import com.cf.exception.BizException;
import com.cf.util.ObjectJsonUtil;

/**
 * game-server-PrimitiveFormate
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/6/8 下午 05:06
 */
public class JsonFormate implements Formate {

    @Override
    public Object formate(String value, Class type) {
        try {
            return ObjectJsonUtil.toObject(value, type);
        } catch (Exception e) {
            throw new BizException(EnumReturnCode.ERROR.getCode(), "数据转换异常！");
        }
    }

}
